package com.spic.business.mq.service;

//import com.rabbitmq.client.*;
import com.spic.business.mq.utils.ConnextionUtil;

import java.io.IOException;

/**
 * @author 290512
 * @create 2022-05-13 16:01
 *
 * 测试类
 */
public class Recver
{
//    private final  static String EXCHANGE_NAME = "position_report_exchange";
//    public static void main(String[] args) throws Exception
//    {
//        //获取连接
//        Connection connection = ConnextionUtil.getConnection();
//        //创建通道
//        Channel channel = connection.createChannel();
//
//
//        channel.queueDeclare("position_report_queue",false,false,false,null);
//        //绑定队列到交换机
//        channel.queueBind("position_report_queue",EXCHANGE_NAME,"position.report.notify");
//
//        Consumer consumer = new DefaultConsumer(channel){
//            @Override
//            public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body)
//                    throws IOException
//            {
//                String message = new String(body, "UTF-8");
//                System.out.println( message);
//                channel.basicAck(envelope.getDeliveryTag(),false);
//            }
//        };
//        channel.basicConsume("position_report_queue",false,consumer);
//
//    }
}
